<div class="flash_notice">
<% if !flash[:notice].blank?%>
    <%= flash[:notice] %>
<% end %>
</div>

<h1>Creation of a new product</h1>

</br></br>

<table summary="Product form field">
  <%= form_for @product do |f| %>

      <tr>
        <th> <%= f.label :name %>  </th>
        <td>  <%= f.text_field :name %>  </td>
      </tr>
      <tr>
        <th>  <%= f.label :on_market_on %> </th>
        <td>  <%= f.date_select :on_market_on %> </td>
      </tr>

      <tr>
        <th> <%= f.label :product_id, 'Designers' %> </th>
        <td> <%= collection_select :product, :designer_ids, @designers, :id, :name,
            { :selected => @product.designer_ids },
            { :multiple => true, :name => 'product[designer_ids][]' } -%> </td>
      </tr>

      <tr>
        <th> <%= f.label :product_id, 'Shops' %> </th>
        <td> <%= collection_select :product, :shop_ids, @shops, :id, :name,
                                   { :selected => @product.shop_ids },
                                   { :multiple => true, :name => 'product[shop_ids][]' } -%> </td>
      </tr>

      <tr>
        <th> <%= f.label :product_id, 'Suggested products' %> </th>
        <td> <%= collection_select :product, :suggested_product_ids, @products, :id, :name,
                                   { :selected => @product.suggested_product_ids },
                                   { :multiple => true, :name => 'product[suggested_product_ids][]' } -%> </td>
      </tr>

      <tr>
        <th>  <%= f.label :must_have %> </th>
        <td>  <%= f.check_box(:must_have) %> </td>
      </tr>
      <tr>
        <th> <%= f.label :product_type_id %>  </th>
        <td>  <%= collection_select :product, :product_type_id, @product_types, :id, :name %> </td>
      </tr>
      <tr>
        <th> <%= f.label :description %>  </th>
        <td>  <%= f.text_area :description, :size => "80x5" %> </td>
      </tr>
      <tr>
        <th> <%= f.label :image_url, 'Image' %>  </th>
        <td>  <%= f.file_field :image_url %> </td>
      </tr>
      <tr>
        <th>  <%= f.label :datasheet %> </th>
        <td>  <%= f.text_area :datasheet, :size => "80x5" %> </td>
      </tr>
      <tr>
        <th> <%= f.label :tech_image_url, 'Technical image' %>  </th>
        <td> <%= f.file_field :tech_image_url %>  </td>
      </tr>

      <tr>
        <th> <%= f.label :partner %>  </th>
        <td>  <%= collection_select :product, :partner_id, @partners, :id, :name, :include_blank => true %> </td>
      </tr>

      <tr>
        <th> </br>  </th>
        <td>   </td>
      </tr>
      <tr>
        <th>  <%= f.submit %> </th>
        <td>   </td>
      </tr>
      </table>
<% end %>


  <%= link_to "logout", :controller => 'admin',:action => 'logout' %>